﻿/*
 *
 * shell.h
 *
 *  Created on: 2016-11-23
 *      Author: chenshisheng
 */

#ifndef MAIN_SHELL_H_
#define MAIN_SHELL_H_

#include "main.h"
#include "stream/stream.h"
#include "message_queue.h"

#include <stdlib.h>


typedef int (* Shell_Callback_t)(Stream_t *stream, int argc, char *argv[]);

typedef struct
{
    const char *name;
    Shell_Callback_t callback;
    const char *brief;
    const char *usage;
}Shell_Cmd_t;

void Shell_Init(const Shell_Cmd_t cmdList[], unsigned int size);
void Shell_OnLine(const MsgQueue_Msg_t *msg);
void Shell_PrintHelp(Stream_t *stream, const char *cmdName);
int Shell_Help(Stream_t *stream, int argc, char *argv[]);
int Shell_Test(Stream_t *stream, int argc, char *argv[]);
int Shell_Watch(Stream_t *stream, int argc, char *argv[]);
int Shell_Bridge(Stream_t *stream, int argc, char *argv[]);
int Shell_Version(Stream_t *stream, int argc, char *argv[]);

void Shell_OnSerialSend(const MsgQueue_Msg_t *msg);

#endif /* MAIN_SHELL_H_ */
